//
//  OAHomeViewController.m
//  LongOA
//
//  Created by 耿用强 on 15/7/5.
//  Copyright (c) 2015年 耿用强. All rights reserved.
//

#import "OAHomeViewController.h"
#import "OAEmailViewController.h"
#import "OADocumentViewController.h"

@interface OAHomeViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    NSArray*_nameArray;
}
@end

@implementation OAHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _nameArray=@[@"内部邮件",@"公告",@"公文",@"工组质检",@"客户走访",@"工序质检申请"];
    [self setNavBarleftBtn:@"" andlDimg:@"" rightBtn:@"" andrImg:@"" title:@"龙嘉OA" ];
    [self buildTables:CGRectMake(0, HEADER_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT-HEADER_HEIGHT) andHeaderView:nil andFooterView:nil andAlwaysBounceVertical:YES Delegate:self DataSouce:self];
    self.tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;

    // Do any additional setup after loading the view.
}


#pragma mark - UITableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _nameArray.count;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString*homeCellIdentifer=@"homeCellIdentifer";
    UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:homeCellIdentifer];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:homeCellIdentifer];
    }
    cell.textLabel.text=_nameArray[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row==0) {
        OAEmailViewController* vc=[[OAEmailViewController alloc] init];
        [self presentViewController:vc animated:NO completion:nil];
    } else if (indexPath.row==2) {
        OADocumentViewController* vc=[[OADocumentViewController alloc] init];
        [self presentViewController:vc animated:NO completion:nil];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
